#include <iostream>
#define N 100

using namespace std;

void readintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}

void swap_odd_even(int array[], int elements){
int i, j, aux;
j=1;
for(i=0;i<elements;i++){
	j=0;
	if(array[i]%2!=0)
		while (array[j]%2==0 && j<elements)
			++j;
	if(j!=elements){
		aux=array[i];
		array[i]=array[j];
		array[j]=aux;
		}
	}
}

void printintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}

int main(){
int array[N];
int elements;
cout<<"Type the number of elements you want in the array : ";
cin>>elements;
readintVector(array, elements);
cout<<"The original array is ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;
swap_odd_even(array, elements);
cout<<"The array with swapped odd and even elements is: "<<endl;
printintVector(array, elements);
return 0;
}
